package org.fqh.system.controller;

import java.util.ArrayList;
import java.util.List;

import org.fqh.system.entity.TSysOrganization;
import org.fqh.system.entity.TSysResource;
import org.fqh.system.entity.TreeVo;
import org.fqh.system.service.TSysOrganizationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.alibaba.fastjson.JSON;

/**
* @author fqh 
* @version 创建时间：2018年1月29日 下午2:28:16
* 类说明
*/
@Controller
@RequestMapping("/org")
public class TSysOrgController {
	
	@Autowired
	TSysOrganizationService orgService;
	
	@RequestMapping("/tree")
	public String orgTree() {
		return "system/org/orgTree";
	}
	
 	
 	@ResponseBody
 	@RequestMapping(value="/treeList")
 	public String treeList() {
	    List<TSysOrganization> resource =new ArrayList<>();
	    String jsonStr = new String();
		try {
			resource =  orgService.selectAll();
			List<TreeVo> treeList = new ArrayList<TreeVo>();
			 
			jsonStr=JSON.toJSONString(treeList);
			System.out.println(jsonStr);
			
		} catch (Exception e) {
			e.printStackTrace();
		}
		return jsonStr;
 	}
}
